
# 5.现有字典 d={'a':24,'g':52,'i':12,'k':33}请按value值进行排序?
d={'a':24,'g':52,'i':12,'k':33}
sorted(d.items(),key=lambda x:x[1])

# 6.字典推导式
d1={key:value for (key,value) in iterale}

# 7.请反转字符串"aStr"?
print("aStr"[::-1])

# 8.将字符串"k:1 k1:2/k2:3|k3:4"，处理成字典 {k:1,k1:2,...]
str1 ="k:1|k1:2|k2:3|k3:4"
def str2dict(str1):
    dict1 = {}
    for iterms in str1.split(''):
        key,value = iterms .split(':')
        dict1[key] = value
    return dict1
